(function(app){
	app
		.controller("content_23_checkCtrl",["$scope","$state","myFactory",'$stateParams',"$q",'$timeout','$location','$http','$ionicHistory',function($scope,$state,myFactory,$stateParams,$q,$timeout,$location,$http,$ionicHistory){
			//接收参数
			var chdrnum01 =  $stateParams.chdrnum01; //保单号
			var chdrcoy = $stateParams.chdrcoy; //保单公司号码
			var state = $stateParams.state;//获得跳转过来的路由
			var item23 = $stateParams.item23;

			//绑定到页面
			$scope.chdrnum01 = $stateParams.chdrnum01;
			$scope.showFlag = true; //控制前端是否显示“详情、重审、退出”三个功能
			$scope.item23 = $stateParams.item23;
			var token=sessionStorage.getItem("token");

			var isAdd = item23.isAdd;
			$scope.show23CheckbjItemFlag=false;
			if(isAdd!='O'){
				$scope.show23CheckbjItemFlag=true;
				if(isAdd=='Y'){
					$scope.paymentOptions="补缴欠缴保险费";
				}else{
					$scope.paymentOptions="不补缴欠缴保险费";
				}
			}

			$scope.data = {

			};

			//根据路由判断是否要显示详情、重新受理、退出三个功能
			if("history_detail"==state){
				$scope.showFlag = false;//不显示
			}

			//重新受理
			$scope.renew = function(){
				myFactory.renew();
			}

			//退出移动保全
			$scope.exit = function(){
				myFactory.exit();
			}

			//返回函数
			$scope.goBack = function () {
				myFactory.goBack();
			}

			//关闭遮罩
			$scope.overwindowClose = function(){
				$(".overwindow").hide();
				$(".overmodal").hide();
			}

			//保单详情弹窗
			$scope.showPolicyDetail = function(){
				modal('open','policyModalOn23Check','policyWindowOn23Check','policyCloseXOn23Check');
				var timestamp=myFactory.getTimetamp();
				var sfis= "chdrnum-chdrcoy-token-timestamp";
				var signStr="chdrnum="+chdrnum01+"&chdrcoy="+chdrcoy+"&token="+token+"&timestamp="+timestamp;//encodeURI(name)
				var sign = myFactory.hex(signStr);
				//初始化时候查询保单详情
				$http({
					method: 'GET',
					url: app.domain + 'query/restFindPolicyDetail.action',
					params: {'chdrnum': chdrnum01,'chdrcoy': chdrcoy,'sign':sign,'sfis':sfis,'token':token,'timestamp':timestamp}
				}).then(function successCallback(response) {
					if (response.data.success) {
						policyData = response.data.data;
						$scope.policyData = policyData;
						$scope.policyData.ptdate01=myFactory.DateTools($scope.policyData.ptdate01);
					}
				}, function errorCallback(response) {
					$.alert({
						title: '',
						text: '初始化查询订单详情失败!',
						onOK: function () {
							//点击确认
						}
					});
				});
			}

			//保单详情弹窗关闭函数
			$scope.policyCancelOn23Check = function(){
				modal('close','policyModalOn23Check','policyWindowOn23Check','policyCloseXOn23Check');
			}

		}]);        
})(app)